import { Overview } from '@/domain/common/types/common';
import type { Column, Page, Options, PageItemSearch, ResSearch, OpButton } from '@/domain/common/types/page';
import { DefineComponent, PropType } from 'vue';
import { Tend } from './tend';

/**
 * 返回数据格式
 */
export type ResPageList<T> = {
  column?: Array<Column>;
  overview?: Overview;
  trend?: Tend;
  datas: Array<{ row: T; op_group: Array<OpButton> }>;
  page: Page;
};
export type YearId = number;
export type TermId = number;
export type DepartId = number;
export type BaseDeptId = number;
export type SubjectId = number;
export type GradeId = number;
export type ChildId = number;
export type DownLoadId = number;
export type Workercode = number;
export type PrimaryID = number;
export type CommonReqParam = {
  year_id: YearId;
  term_id: TermId;
  depart_id: DepartId;
  base_dept_id: BaseDeptId;
  subject_id: SubjectId;
  grade_id: GradeId;
  child_id: ChildId;
} & Page;

export type PaneInfo = {
  title: string;
  content: string | JSX.Element;
  key: string;
  closable: boolean;
  childId?: number;
};
export type Panes = { [str: string]: PaneInfo };

export enum ErrorChildId {
  DefaultChildId = -1
}
export type BaseDefineComponent = DefineComponent<{
  childId: { type: PropType<Number>; default: ErrorChildId };
  add: { type: PropType<(title: string, id: number) => void>; default: () => {} };
}>;
